package com.example.campusforumapi.util;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

@Setter
@Getter
public class PageResult implements Serializable{
//    总记录数
        private long totalCount;
//        每页记录数
        private int pageSize;
//        总页数
        private int totalPage;
//        当前页数
        private int currPage;
//        列表数据
        private List<?> list;

    public PageResult(List<?> list,long totalCount, int pageSize, int currPage) {
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.totalPage = (int) Math.ceil((double) totalCount/pageSize);
        this.currPage = currPage;
        this.list = list;
    }

    }

